﻿//
// Created by Administrator on 2020/8/29.
//

#ifndef EXAMPLE_CPP_STRING_H
#define EXAMPLE_CPP_STRING_H

#include <iostream>

class String {
private:
    int size;
    char *innerContent;
    static int StrNum;
public:
    String(const char *content);

    /**
     * 复制构造函数
     * @param oStr
     */
    String(const String &oStr);

    ~String();

    /**
     * 赋值构造函数
     * @param oStr
     * @return
     */
    String &operator=(const String &oStr);

    inline const char &operator[](int index) const {
        return innerContent[index];
    }

    friend std::ostream &operator<<(std::ostream &os, const String &str);

    inline static int getStrNum() {
        return StrNum;
    }
};


#endif //EXAMPLE_CPP_STRING_H
